/* eslint-disable @typescript-eslint/no-empty-interface */
/* eslint-disable no-useless-constructor */
/* eslint-disable react/prefer-stateless-function */
import React, { createRef } from 'react'
import { withRouter } from "react-router-dom"
import LoginView from './components/login'
import RegisterView from './components/register'
import './index.scss'

interface IProps{ }
interface IState{
  logining: boolean;
  currentView: string;
}
class Index extends React.Component<IProps,IState> {
  childLogin: any;
  state: any
  constructor(props) {
    super(props)
    this.state = {
      logining: false,
      currentView: 'login'
    }
    this.childLogin = createRef()
  }
  changeView(view) {
    this.setState({ currentView: view })
  }
  render():JSX.Element {
    return (
      <div className='login-content'>
        {
          this.state.currentView === 'login' ? <LoginView ref={this.childLogin} parent={this} /> : <RegisterView parent={this}/>
        }

      </div>
    )
  }
}
export default withRouter(Index)
